package example.book.enums;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
@NoArgsConstructor
@AllArgsConstructor
public enum BookStatus {
    DELETED(0,"无效"),
    NORMAL(1,"可借阅"),
    FORBIDDEN(2," 不可借阅");
    @Getter
    private Integer code;
    @Getter
    private String name;
    public static BookStatus  getNameByCode(Integer code) {
        switch (code) {
            case 0:
                return DELETED;
            case 1:
                return NORMAL;
            case 2:
                return FORBIDDEN;
        }
        return null;
    }

}
